class Solution {
public:
    int maxArea(vector<int>& height) {
        int myleft=0;
        int myright=height.size()-1;
        int ret=0;
        while(myleft<myright)
        {
            int v=min(height[myleft],height[myright])*(myright-myleft);
            ret=max(v,ret);
            if(height[myleft]>height[myright])
            {
                myright--;
            }
            else
            {
                myleft++;
            }
        }
        return ret;
    }
};
